/*
 * Created by Jaren at 2021/10/29 11:39
 */
import 'dart:typed_data';

abstract class Compact<T> {
  static final Compact defaultCompact = DefaultCompact();

  void fromBytes(T output, Uint8ClampedList bytes, int offset);

  int length();
}

class DefaultCompact<T> extends Compact<T> {
  @override
  void fromBytes(T output, Uint8ClampedList bytes, int offset) {}

  @override
  int length() {
    return 0;
  }
}

abstract class CmdCompact {
  int realTimeDataCmd() {
    return 1;
  }

  int realTimeStateCmd() {
    return 2;
  }

  int realTimeErrorCmd() {
    return 3;
  }

  int allRealTimeInfoCmd() {
    return 4;
  }

  int deviceInfoCmd() {
    return 6;
  }

  int deviceRealTimeInfoCmd() {
    return 7;
  }

  int fwVersion() {
    return 4;
  }

  int historyStatisticsCmd() {
    return 16;
  }

  int totalHistoryStatisticsCmd() {
    return 17;
  }

  int tBoxEsimListCmd() {
    return 16;
  }

  int tBoxRealTimeInfoCmd() {
    return 1;
  }

  int tBoxCmd() {
    return 4;
  }

  int tBoxDeviceId() {
    return 8;
  }

  int tBoxUserInfo() {
    return 2;
  }

  int rebootTBoxCmd() {
    return 15;
  }

  int startUpgradingFirmware() {
    return 14;
  }

  int startTransferFirmware() {
    return 15;
  }

  int settingsCmd();

  int lockCmd();

  int headlightOnOffCmd();

  int speedLimitCmd();

  int ridingModeCmd();

  int safeSpeedLimitCmd();
}

abstract class SimpleBMSFeatureCmdTrait {
  int bmsCellsVoltageCmd();
}

abstract class FullBMSFeatureCmdTrait extends SimpleBMSFeatureCmdTrait {
  int bmsRealTimeInfoCmd();

  int bmsFixedInfoCmd();

  int bmsDateCmd();
}
